﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DomainModel;
using NHibernate;

namespace Common
{
    public class DbTestBase
    {
        protected void InDbSession(Action<ISession> code)
        {
            var session = SessionProvider.NewSession;

            InDbTransaction(session, code);
        }

        protected void InDbTransaction(ISession session, Action<ISession> code)
        {
            using (var transaction = session.BeginTransaction())
            {
                code(session);
                transaction.Rollback();
            }
        }
    }
}
